package com.wyl.pmd.rule.bestpractices;

public class ArrayIsStoredDirectly {

	private String[] x;

	// bad
	public void foo(String[] param) {

		this.x = param;
	}

	// good
	public void foo1(String[] param) {
		if (param == null || param.length <= 0) {
			return;
		}
		String[] p = new String[param.length];
		for (int i = 0; i < param.length; i++) {
			p[i] = param[i];
		}
		this.x = p;
	}

}
